$dir = $ARGV[0];
chomp($dir);
if($dir !~ m/\w/)
{
	die "no directory exists with name $dir\ntry perl perl_update_QC_headers.pl <INDIR>\n";
}
$files=`find $dir -name '*qc'`;
@files=split("\n",$files);
for($i=0;$i<@files;$i++)
{
	print $files[$i]."\n";
	$temp=$files[$i].'_temp';
	open(BUFF,"$files[$i]") or die "no file exists $files[$i]\n";
	open(WRBUFF,">$temp") or die "cannot create file $temp\n";
	$header=<BUFF>;
	print WRBUFF "SampleID\tFLAG\tMISSING_GENO_CLEAN\tNUM_GENO_CLEAN\tQC_SAMPLE_FLAG\tQC_SAMPLE_IND\tQC_SEX_IND\tPLINK_SEX_IMP_ESTIMATE\tEUR\tASN\tYRI\n";	
	while(<BUFF>)
	{
		$_ =~ s/ /\t/g;
		print WRBUFF $_;
	}
	system("mv $temp $files[$i]");
	#die "done\n";
}
